(function(f, e, b) {
    var d = {
        box: "<div class='cover-box'><div><img src='' class='cover-img' width='28' height='28'><p class=\"cover-title\">拼命加载中, 请稍后...</p></div></div>",
        fixed: "<div class='cover-fixed'></div>",
        abs: "<div class='cover-abs'></div>"
    },
    a = (function() {
        var h = document.scripts;
        return h[h.length - 1].src.substring(0, h[h.length - 1].src.lastIndexOf("/") + 1)
    } ()),
    g = {
        imgSrc: a + "images/loading.gif"
    };
    var c = function(m, j) {
        var l = this;
        var i = f("<div class='cover-container'></div>");
        var k = f(d.box);
        var h = (function() {
            if (m[0] === document || m[0] === e || m[0] === document.body) {
                m = f(e);
                return f(d.fixed)
            } else {
                return f(d.abs)
            }
        } ());
        i.append(k).append(h).appendTo("body");
        k.find(".cover-img").attr("src", g.imgSrc);
        l.show = function(s, r) {
            var n = k.children("div");
            var p = m.outerWidth();
            var q = m.outerHeight();
            var t = k.outerWidth() + n.outerWidth();
            var o = k.outerHeight() + n.outerHeight();
            if (h.hasClass("cover-abs")) {
                i.css({
                    left: m.offset().left,
                    top: m.offset().top,
                    width: p,
                    height: q
                });
                k.offset({
                    left: (p - t) / 2,
                    top: (q - o) / 2
                })
            } else {
                k.css("position", "fixed");
                k.css({
                    left: (p - t) / 2,
                    top: (q - o) / 2
                })
            }
            if (s) {
                k.find(".cover-title").text(text)
            }
            i.fadeIn(r || 500)
        };
        l.hide = function(n) {
            i.fadeOut(n || 500)
        };
        return l
    };
    f.fn.cover = function(j) {
        var i = f(this);
        var h = i.data("cover-container");
        if (h) {
            h.show(j)
        } else {
            h = new c(i);
            i.data("cover-container", h);
            h.show(j)
        }
    };
    f.fn.uncover = function() {
        var i = f(this);
        var h = i.data("cover-container");
        if (h) {
            h.hide()
        }
    }
} (jQuery, window));